package com.cyy.swiperefresh;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

/**
 * Created by 999555yun on 2016/7/12.
 */
public class MyAdaptr extends BaseAdapter{
    private List<String> mDatas;
    private Context mContext;
    public MyAdaptr (Context context,List<String> datas){
        this.mContext = context;
        this.mDatas = datas;
    }
//hhiiihhk
    @Override
    public int getCount() {
        return mDatas==null ? 0: mDatas.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if(convertView==null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.text_lv,parent,false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.tv.setText(mDatas.get(position));
        return convertView;
    }
    class ViewHolder {
        private TextView tv;
        public ViewHolder(View itemview){
            tv = (TextView) itemview.findViewById(R.id.Text_lv);
        }
    }
}
